bitkeeper revision 1.1709.1.3 (42ae02a99ck6N11hVBch3RRAXKHWgw)
authordjm@sportsman.spdomain <djm@sportsman.spdomain>
Mon, 13 Jun 2005 22:03:21 +0000 (22:03 +0000)
committerdjm@sportsman.spdomain <djm@sportsman.spdomain>
Mon, 13 Jun 2005 22:03:21 +0000 (22:03 +0000)
Various fixes for multi-domain prep

Signed-off-by: Matthew Chapman <matthewc@hp.com>
.rootkeys
xen/arch/ia64/dom0_ops.c
xen/arch/ia64/domain.c
xen/arch/ia64/hypercall.c
xen/arch/ia64/patch/linux-2.6.11/uaccess.h [new file with mode: 0644]
xen/arch/ia64/tools/mkbuildtree
xen/arch/ia64/vcpu.c
xen/arch/ia64/xenmisc.c
xen/include/asm-ia64/config.h
xen/include/asm-ia64/domain.h
xen/include/public/arch-ia64.h

index 30f525d435b87814b54131bf0d28cfefd8e2e2d7..ca944205bb1cde176984c4c94ea7002f38a85059 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c
 425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c
 425ae5162bIl2Dgd19x-FceB4L9oGw xen/arch/ia64/patch/linux-2.6.11/types.h
+42ae01f01KDfSgVQnscwJ0psRmEaCw xen/arch/ia64/patch/linux-2.6.11/uaccess.h
 425ae516cFUNY2jHD46bujcF5NJheA xen/arch/ia64/patch/linux-2.6.11/unaligned.c
 421098b39QFMC-1t1r38CA7NxAYBPA xen/arch/ia64/patch/linux-2.6.7/bootmem.h
 421098b3SIA1vZX9fFUjo1T3o_jMCQ xen/arch/ia64/patch/linux-2.6.7/current.h
index e0b48080bca7d3fcd0f615918f59137673eef72c..c1b1d5c241e4b2c14f7ca2fa71b69b6b064d3f46 100644 (file)
 #include <xen/console.h>
 #include <public/sched_ctl.h>
 
-#define TRC_DOM0OP_ENTER_BASE  0x00020000
-#define TRC_DOM0OP_LEAVE_BASE  0x00030000
-
-static int msr_cpu_mask;
-static unsigned long msr_addr;
-static unsigned long msr_lo;
-static unsigned long msr_hi;
-
 long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op)
 {
     long ret = 0;
@@ -35,6 +27,49 @@ long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op)
 
     switch ( op->cmd )
     {
+    /*
+     * NOTE: DOM0_GETMEMLIST has somewhat different semantics on IA64 -
+     * it actually allocates and maps pages.
+     */
+    case DOM0_GETMEMLIST:
+    {
+        unsigned long i;
+        struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
+        unsigned long start_page = op->u.getmemlist.max_pfns >> 32;
+        unsigned long nr_pages = op->u.getmemlist.max_pfns & 0xffffffff;
+        unsigned long pfn;
+        unsigned long *buffer = op->u.getmemlist.buffer;
+        struct page *page;
+
+        ret = -EINVAL;
+        if ( d != NULL )
+        {
+            ret = 0;
+
+            for ( i = start_page; i < (start_page + nr_pages); i++ )
+            {
+                page = map_new_domain_page(d, i << PAGE_SHIFT);
+                if ( page == NULL )
+                {
+                    ret = -ENOMEM;
+                    break;
+                }
+                pfn = page_to_pfn(page);
+                if ( put_user(pfn, buffer) )
+                {
+                    ret = -EFAULT;
+                    break;
+                }
+                buffer++;
+            }
+
+            op->u.getmemlist.num_pfns = i - start_page;
+            copy_to_user(u_dom0_op, op, sizeof(*op));
+            
+            put_domain(d);
+        }
+    }
+    break;
 
     default:
         ret = -ENOSYS;
@@ -43,10 +78,3 @@ long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op)
 
     return ret;
 }
-
-void arch_getdomaininfo_ctxt(struct domain *d, struct vcpu_guest_context *c)
-{ 
-    int i;
-
-       dummy();
-}
index 869396ed06d6104cd667fcd6609145cc6c180648..939173df50ad89abad32eb70cb8d47e1acf55870 100644 (file)
@@ -76,7 +76,7 @@ extern unsigned long dom_fw_setup(struct domain *, char *, int);
 /* this belongs in include/asm, but there doesn't seem to be a suitable place */
 void free_perdomain_pt(struct domain *d)
 {
-       dummy();
+       printf("free_perdomain_pt: not implemented\n");
        //free_page((unsigned long)d->mm.perdomain_pt);
 }
 
@@ -166,12 +166,34 @@ void arch_free_vcpu_struct(struct vcpu *v)
        free_xenheap_pages(v, KERNEL_STACK_SIZE_ORDER);
 }
 
+static void init_switch_stack(struct vcpu *v)
+{
+       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+       struct switch_stack *sw = (struct switch_stack *) regs - 1;
+       extern void ia64_ret_from_clone;
+
+       memset(sw, 0, sizeof(struct switch_stack) + sizeof(struct pt_regs));
+       sw->ar_bspstore = (unsigned long)v + IA64_RBS_OFFSET;
+       sw->b0 = (unsigned long) &ia64_ret_from_clone;
+       sw->ar_fpsr = FPSR_DEFAULT;
+       v->arch._thread.ksp = (unsigned long) sw - 16;
+       // stay on kernel stack because may get interrupts!
+       // ia64_ret_from_clone (which b0 gets in new_thread) switches
+       // to user stack
+       v->arch._thread.on_ustack = 0;
+       memset(v->arch._thread.fph,0,sizeof(struct ia64_fpreg)*96);
+}
+
 #ifdef CONFIG_VTI
 void arch_do_createdomain(struct vcpu *v)
 {
        struct domain *d = v->domain;
        struct thread_info *ti = alloc_thread_info(v);
 
+       /* Clear thread_info to clear some important fields, like preempt_count */
+       memset(ti, 0, sizeof(struct thread_info));
+       init_switch_stack(v);
+
        /* If domain is VMX domain, shared info area is created
         * by domain and then domain notifies HV by specific hypercall.
         * If domain is xenolinux, shared info area is created by
@@ -194,9 +216,6 @@ void arch_do_createdomain(struct vcpu *v)
        }
        memset(v->vcpu_info, 0, PAGE_SIZE);
 
-       /* Clear thread_info to clear some important fields, like preempt_count */
-       memset(ti, 0, sizeof(struct thread_info));
-
        /* Allocate per-domain vTLB and vhpt */
        v->arch.vtlb = init_domain_tlb(v);
 
@@ -212,37 +231,37 @@ void arch_do_createdomain(struct vcpu *v)
        d->xen_vaend = 0xf300000000000000;
        d->arch.breakimm = 0x1000;
 
-       // stay on kernel stack because may get interrupts!
-       // ia64_ret_from_clone (which b0 gets in new_thread) switches
-       // to user stack
-       v->arch._thread.on_ustack = 0;
+       d->arch.mm = xmalloc(struct mm_struct);
+       if (unlikely(!d->arch.mm)) {
+               printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
+               return -ENOMEM;
+       }
+       memset(d->arch.mm, 0, sizeof(*d->arch.mm));
+       d->arch.mm->pgd = pgd_alloc(d->arch.mm);
+       if (unlikely(!d->arch.mm->pgd)) {
+               printk("Can't allocate pgd for domain %d\n",d->domain_id);
+               return -ENOMEM;
+       }
+}
 }
 #else // CONFIG_VTI
 void arch_do_createdomain(struct vcpu *v)
 {
        struct domain *d = v->domain;
+       struct thread_info *ti = alloc_thread_info(v);
+
+       /* Clear thread_info to clear some important fields, like preempt_count */
+       memset(ti, 0, sizeof(struct thread_info));
+       init_switch_stack(v);
 
        d->shared_info = (void *)alloc_xenheap_page();
-       v->vcpu_info = (void *)alloc_xenheap_page();
-       if (!v->vcpu_info) {
+       if (!d->shared_info) {
                printk("ERROR/HALTING: CAN'T ALLOC PAGE\n");
                while (1);
        }
-       memset(v->vcpu_info, 0, PAGE_SIZE);
-       /* pin mapping */
-       // FIXME: Does this belong here?  Or do only at domain switch time?
-#if 0
-       // this is now done in ia64_new_rr7
-       {
-               /* WARNING: following must be inlined to avoid nested fault */
-               unsigned long psr = ia64_clear_ic();
-               ia64_itr(0x2, IA64_TR_SHARED_INFO, SHAREDINFO_ADDR,
-                pte_val(pfn_pte(ia64_tpa(d->shared_info) >> PAGE_SHIFT, PAGE_KERNEL)),
-                PAGE_SHIFT);
-               ia64_set_psr(psr);
-               ia64_srlz_i();
-       }
-#endif
+       memset(d->shared_info, 0, PAGE_SIZE);
+       v->vcpu_info = &(d->shared_info->vcpu_data[0]);
+
        d->max_pages = (128*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
        if ((d->arch.metaphysical_rr0 = allocate_metaphysical_rr0()) == -1UL)
                BUG();
@@ -258,33 +277,63 @@ void arch_do_createdomain(struct vcpu *v)
        d->shared_info_va = 0xf100000000000000;
        d->arch.breakimm = 0x1000;
        v->arch.breakimm = d->arch.breakimm;
-       // stay on kernel stack because may get interrupts!
-       // ia64_ret_from_clone (which b0 gets in new_thread) switches
-       // to user stack
-       v->arch._thread.on_ustack = 0;
+
+       d->arch.mm = xmalloc(struct mm_struct);
+       if (unlikely(!d->arch.mm)) {
+               printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
+               return -ENOMEM;
+       }
+       memset(d->arch.mm, 0, sizeof(*d->arch.mm));
+       d->arch.mm->pgd = pgd_alloc(d->arch.mm);
+       if (unlikely(!d->arch.mm->pgd)) {
+               printk("Can't allocate pgd for domain %d\n",d->domain_id);
+               return -ENOMEM;
+       }
 }
 #endif // CONFIG_VTI
 
-void arch_do_boot_vcpu(struct vcpu *v)
+void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
 {
-       return;
+       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+
+       printf("arch_getdomaininfo_ctxt\n");
+       c->regs = *regs;
+       c->vcpu = v->vcpu_info->arch;
+       c->shared = v->domain->shared_info->arch;
 }
 
 int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
 {
-       dummy();
-       return 1;
+       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+
+       printf("arch_set_info_guest\n");
+       *regs = c->regs;
+       regs->cr_ipsr = IA64_PSR_IT|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_IC|IA64_PSR_I|IA64_PSR_DFH|IA64_PSR_BN|IA64_PSR_SP|IA64_PSR_DI;
+       regs->cr_ipsr |= 2UL << IA64_PSR_CPL0_BIT;
+       regs->ar_rsc |= (2 << 2); /* force PL2/3 */
+
+       v->vcpu_info->arch = c->vcpu;
+       init_all_rr(v);
+
+       // this should be in userspace
+       regs->r28 = dom_fw_setup(v->domain,"nomca nosmp xencons=ttyS console=ttyS0",256L);  //FIXME
+       v->vcpu_info->arch.banknum = 1;
+       v->vcpu_info->arch.metaphysical_mode = 1;
+
+       v->domain->shared_info->arch = c->shared;
+       return 0;
 }
 
-int arch_final_setup_guest(struct vcpu *v, struct vcpu_guest_context *c)
+void arch_do_boot_vcpu(struct vcpu *v)
 {
-       dummy();
-       return 1;
+       printf("arch_do_boot_vcpu: not implemented\n");
+       return;
 }
 
 void domain_relinquish_resources(struct domain *d)
 {
-       dummy();
+       /* FIXME */
+       printf("domain_relinquish_resources: not implemented\n");
 }
 
 #ifdef CONFIG_VTI
@@ -294,10 +343,8 @@ void new_thread(struct vcpu *v,
                 unsigned long start_info)
 {
        struct domain *d = v->domain;
-       struct switch_stack *sw;
        struct xen_regs *regs;
        struct ia64_boot_param *bp;
-       extern char ia64_ret_from_clone;
        extern char saved_command_line[];
        //char *dom0_cmdline = "BOOT_IMAGE=scsi0:\EFI\redhat\xenlinux nomca root=/dev/sdb1 ro";
 
@@ -305,11 +352,8 @@ void new_thread(struct vcpu *v,
 #ifdef CONFIG_DOMAIN0_CONTIGUOUS
        if (d == dom0) start_pc += dom0_start;
 #endif
-       regs = (struct xen_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
-       sw = (struct switch_stack *) regs - 1;
-       /* Sanity Clear */
-       memset(sw, 0, sizeof(struct xen_regs) + sizeof(struct switch_stack));
 
+       regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
        if (VMX_DOMAIN(v)) {
                /* dt/rt/it:1;i/ic:1, si:1, vm/bn:1, ac:1 */
                regs->cr_ipsr = 0x501008826008; /* Need to be expanded as macro */
@@ -320,34 +364,23 @@ void new_thread(struct vcpu *v,
                regs->cr_ipsr |= 2UL << IA64_PSR_CPL0_BIT; // domain runs at PL2
        }
        regs->cr_iip = start_pc;
-       regs->ar_rsc = 0x0;
-       regs->cr_ifs = 0x0;
-       regs->ar_fpsr = sw->ar_fpsr = FPSR_DEFAULT;
-       sw->ar_bspstore = (unsigned long)v + IA64_RBS_OFFSET;
-       printf("new_thread: v=%p, regs=%p, sw=%p, new_rbs=%p, IA64_STK_OFFSET=%p, &r8=%p\n",
-               v,regs,sw,sw->ar_bspstore,IA64_STK_OFFSET,&regs->r8);
-       printf("iip:0x%lx,ipsr:0x%lx\n", regs->cr_iip, regs->cr_ipsr);
-
-       sw->b0 = (unsigned long) &ia64_ret_from_clone;
-       v->arch._thread.ksp = (unsigned long) sw - 16;
-       printk("new_thread, about to call init_all_rr\n");
-       if (VMX_DOMAIN(v)) {
+       regs->cr_ifs = 0; /* why? - matthewc */
+       regs->ar_fpsr = FPSR_DEFAULT;
+       if (VMX_DOMAIN(ed)) {
                vmx_init_all_rr(v);
        } else
                init_all_rr(v);
-       // set up boot parameters (and fake firmware)
-       printk("new_thread, about to call dom_fw_setup\n");
+       /* should this be regs->r28 in the non-VMX case? - matthewc */
        VMX_VPD(v,vgr[12]) = dom_fw_setup(d,saved_command_line,256L);  //FIXME
-       printk("new_thread, done with dom_fw_setup\n");
-
        if (VMX_DOMAIN(v)) {
                /* Virtual processor context setup */
                VMX_VPD(v, vpsr) = IA64_PSR_BN;
                VPD_CR(v, dcr) = 0;
        } else {
-               // don't forget to set this!
                v->vcpu_info->arch.banknum = 1;
+               /* v->vcpu_info->arch.metaphysical_mode = 1;  why not? - matthewc */
        }
+       /* d->shared_info->arch.flags = (d == dom0) ? (SIF_INITDOMAIN|SIF_PRIVILEGED|SIF_BLK_BE_DOMAIN|SIF_NET_BE_DOMAIN|SIF_USB_BE_DOMAIN) : 0;  shared_info not set yet? */
 }
 #else // CONFIG_VTI
 
@@ -359,54 +392,27 @@ void new_thread(struct vcpu *v,
                    unsigned long start_info)
 {
        struct domain *d = v->domain;
-       struct switch_stack *sw;
        struct pt_regs *regs;
-       unsigned long new_rbs;
        struct ia64_boot_param *bp;
-       extern char ia64_ret_from_clone;
        extern char saved_command_line[];
 
 #ifdef CONFIG_DOMAIN0_CONTIGUOUS
        if (d == dom0) start_pc += dom0_start;
 #endif
+
        regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
-       sw = (struct switch_stack *) regs - 1;
-       memset(sw,0,sizeof(struct switch_stack)+sizeof(struct pt_regs));
-       new_rbs = (unsigned long) v + IA64_RBS_OFFSET;
        regs->cr_ipsr = ia64_getreg(_IA64_REG_PSR)
                | IA64_PSR_BITS_TO_SET | IA64_PSR_BN
                & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_RI | IA64_PSR_IS);
        regs->cr_ipsr |= 2UL << IA64_PSR_CPL0_BIT; // domain runs at PL2
        regs->cr_iip = start_pc;
-       regs->ar_rsc = 0;               /* lazy mode */
-       regs->ar_rnat = 0;
-       regs->ar_fpsr = sw->ar_fpsr = FPSR_DEFAULT;
-       regs->loadrs = 0;
-       //regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */
-       //regs->r8 = 0x01234567890abcdef; // FIXME: temp marker
-       //regs->r12 = ((unsigned long) regs - 16);      /* 16 byte scratch */
        regs->cr_ifs = 1UL << 63;
-       regs->pr = 0;
-       sw->pr = 0;
-       regs->ar_pfs = 0;
-       sw->caller_unat = 0;
-       sw->ar_pfs = 0;
-       sw->ar_bspstore = new_rbs;
-       //regs->r13 = (unsigned long) v;
-printf("new_thread: v=%p, start_pc=%p, regs=%p, sw=%p, new_rbs=%p, IA64_STK_OFFSET=%p, &r8=%p\n",
-v,start_pc,regs,sw,new_rbs,IA64_STK_OFFSET,&regs->r8);
-       sw->b0 = (unsigned long) &ia64_ret_from_clone;
-       v->arch._thread.ksp = (unsigned long) sw - 16;
-       //v->thread_info->flags = 0;
-printk("new_thread, about to call init_all_rr\n");
+       regs->ar_fpsr = FPSR_DEFAULT;
        init_all_rr(v);
-       // set up boot parameters (and fake firmware)
-printk("new_thread, about to call dom_fw_setup\n");
        regs->r28 = dom_fw_setup(d,saved_command_line,256L);  //FIXME
-printk("new_thread, done with dom_fw_setup\n");
-       // don't forget to set this!
        v->vcpu_info->arch.banknum = 1;
-       memset(v->arch._thread.fph,0,sizeof(struct ia64_fpreg)*96);
+       v->vcpu_info->arch.metaphysical_mode = 1;
+       d->shared_info->arch.flags = (d == dom0) ? (SIF_INITDOMAIN|SIF_PRIVILEGED|SIF_BLK_BE_DOMAIN|SIF_NET_BE_DOMAIN|SIF_USB_BE_DOMAIN) : 0;
 }
 #endif // CONFIG_VTI
 
@@ -1037,21 +1043,6 @@ int construct_dom0(struct domain *d,
        strcpy(d->name,"Domain0");
 #endif
 
-       // prepare domain0 pagetable (maps METAphysical to physical)
-       // following is roughly mm_init() in linux/kernel/fork.c
-       d->arch.mm = xmalloc(struct mm_struct);
-       if (unlikely(!d->arch.mm)) {
-               printk("Can't allocate mm_struct for domain0\n");
-               return -ENOMEM;
-       }
-       memset(d->arch.mm, 0, sizeof(*d->arch.mm));
-       d->arch.mm->pgd = pgd_alloc(d->arch.mm);
-       if (unlikely(!d->arch.mm->pgd)) {
-               printk("Can't allocate pgd for domain0\n");
-               return -ENOMEM;
-       }
-
-
        /* Mask all upcalls... */
        for ( i = 0; i < MAX_VIRT_CPUS; i++ )
            d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
@@ -1146,19 +1137,6 @@ int construct_domU(struct domain *d,
        printk("parsedomainelfimage returns %d\n",rc);
        if ( rc != 0 ) return rc;
 
-       d->arch.mm = xmalloc(struct mm_struct);
-       if (unlikely(!d->arch.mm)) {
-               printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
-               return -ENOMEM;
-       }
-       memset(d->arch.mm, 0, sizeof(*d->arch.mm));
-       d->arch.mm->pgd = pgd_alloc(d->arch.mm);
-       if (unlikely(!d->arch.mm->pgd)) {
-               printk("Can't allocate pgd for domain %d\n",d->domain_id);
-               return -ENOMEM;
-       }
-
-
        /* Mask all upcalls... */
        for ( i = 0; i < MAX_VIRT_CPUS; i++ )
                d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
@@ -1231,10 +1209,10 @@ void machine_halt(void)
        while(1);
 }
 
-void dummy(void)
+void dummy_called(char *function)
 {
        if (platform_is_hp_ski()) asm("break 0;;");
-       printf("dummy called: spinning....\n");
+       printf("dummy called in %s: spinning....\n", function);
        while(1);
 }
 
index 0fcc6f7cf852274bec31005ad8031bc19458f53b..64947ac59c948e4745b9df9c91e540316ed9fd22 100644 (file)
@@ -19,8 +19,6 @@ extern unsigned long translate_domain_mpaddr(unsigned long);
 extern struct ia64_sal_retval pal_emulator_static(UINT64);
 extern struct ia64_sal_retval sal_emulator(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
 
-void fooefi(void) {}
-
 int
 ia64_hypercall (struct pt_regs *regs)
 {
@@ -122,6 +120,28 @@ ia64_hypercall (struct pt_regs *regs)
            case 0xfffb: // test dummy hypercall
                regs->r8 = domU_staging_read_8(vcpu_get_gr(v,32));
                break;
+
+           case __HYPERVISOR_dom0_op:
+               regs->r8 = do_dom0_op(regs->r14);
+               break;
+
+           case __HYPERVISOR_dom_mem_op:
+               /* regs->r8 = do_dom_mem_op(regs->r14, regs->r15, regs->r16, regs->r17, regs->r18); */
+               /* we don't handle reservations; just return success */
+               regs->r8 = regs->r16;
+               break;
+
+           case __HYPERVISOR_event_channel_op:
+               regs->r8 = do_event_channel_op(regs->r14);
+               break;
+
+           case __HYPERVISOR_console_io:
+               regs->r8 = do_console_io(regs->r14, regs->r15, regs->r16);
+               break;
+
+           default:
+               printf("unknown hypercall %x\n", regs->r2);
+               regs->r8 = (unsigned long)-1;
        }
        return 1;
 }
diff --git a/xen/arch/ia64/patch/linux-2.6.11/uaccess.h b/xen/arch/ia64/patch/linux-2.6.11/uaccess.h
new file mode 100644 (file)
index 0000000..def5aaa
--- /dev/null
@@ -0,0 +1,22 @@
+--- ../../linux-2.6.11/include/asm-ia64/uaccess.h      2005-06-06 10:36:23.000000000 -0600
++++ include/asm-ia64/uaccess.h 2005-06-10 18:08:06.000000000 -0600
+@@ -60,6 +60,11 @@
+  * address TASK_SIZE is never valid.  We also need to make sure that the address doesn't
+  * point inside the virtually mapped linear page table.
+  */
++#ifdef XEN
++/* VT-i reserves bit 60 for the VMM; guest addresses have bit 60 = bit 59 */
++#define IS_VMM_ADDRESS(addr) ((((addr) >> 60) ^ ((addr) >> 59)) & 1)
++#define __access_ok(addr, size, segment) (!IS_VMM_ADDRESS((unsigned long)(addr)))
++#else
+ #define __access_ok(addr, size, segment)                                              \
+ ({                                                                                    \
+       __chk_user_ptr(addr);                                                           \
+@@ -67,6 +72,7 @@
+        && ((segment).seg == KERNEL_DS.seg                                             \
+            || likely(REGION_OFFSET((unsigned long) (addr)) < RGN_MAP_LIMIT)));        \
+ })
++#endif
+ #define access_ok(type, addr, size)   __access_ok((addr), (size), get_fs())
+ static inline int
index 5964c836c8ae6dc1b1d1c6f69b280b18f5557966..18d0c72c6741f3731a7e203c260fc7dd9aea6dad 100644 (file)
@@ -259,7 +259,7 @@ softlink include/asm-ia64/string.h include/asm-ia64/string.h
 softlink include/asm-ia64/thread_info.h include/asm-ia64/thread_info.h
 softlink include/asm-ia64/timex.h include/asm-ia64/timex.h
 softlink include/asm-ia64/topology.h include/asm-ia64/topology.h
-softlink include/asm-ia64/uaccess.h include/asm-ia64/uaccess.h
+cp_patch include/asm-ia64/uaccess.h include/asm-ia64/uaccess.h uaccess.h
 softlink include/asm-ia64/unaligned.h include/asm-ia64/unaligned.h
 softlink include/asm-ia64/unistd.h include/asm-ia64/unistd.h
 softlink include/asm-ia64/unwind.h include/asm-ia64/unwind.h
index b55e5b6bd7bdfb6b6412f984e512354af263dc76..9ba20cd11ec02cc39711f40155a953ee1ad0e31b 100644 (file)
@@ -539,7 +539,7 @@ void vcpu_pend_interrupt(VCPU *vcpu, UINT64 vector)
     } else
 #endif // CONFIG_VTI
     {
-       if (!test_bit(vector,PSCB(vcpu,delivery_mask))) return;
+       /* if (!test_bit(vector,PSCB(vcpu,delivery_mask))) return; */
        if (test_bit(vector,PSCBX(vcpu,irr))) {
 //printf("vcpu_pend_interrupt: overrun\n");
        }
@@ -569,10 +569,10 @@ UINT64 vcpu_check_pending_interrupts(VCPU *vcpu)
        UINT64 *p, *q, *r, bits, bitnum, mask, i, vector;
 
        p = &PSCBX(vcpu,irr[3]);
-       q = &PSCB(vcpu,delivery_mask[3]);
+       /* q = &PSCB(vcpu,delivery_mask[3]); */
        r = &PSCBX(vcpu,insvc[3]);
        for (i = 3; ; p--, q--, r--, i--) {
-               bits = *p & *q;
+               bits = *p /* & *q */;
                if (bits) break; // got a potential interrupt
                if (*r) {
                        // nothing in this word which is pending+inservice
index bb9f83019a8e0da51dac609def49c9cccb12811b..6703b397ab2049450b37fc26676659620e5768f4 100644 (file)
@@ -63,13 +63,7 @@ void sync_lazy_execstate_mask(cpumask_t mask) {}
 void sync_lazy_execstate_all(void) {}
 
 int grant_table_create(struct domain *d) { return 0; }
-void grant_table_destroy(struct domain *d)
-{
-       printf("grant_table_destroy: domain_destruct not tested!!!\n");
-       printf("grant_table_destroy: ensure atomic_* calls work in domain_destruct!!\n");
-       dummy();
-       return;
-}
+void grant_table_destroy(struct domain *d) { return; }
 
 struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); }
 
index 442d49a382f6fef54832de583ce751b3872ab09e..9df0d907aaff056de3dab511229ff61458608886 100644 (file)
@@ -177,8 +177,7 @@ void sort_main_extable(void);
 // see include/asm-x86/atomic.h (different from standard linux)
 #define _atomic_set(v,i) (((v).counter) = (i))
 #define _atomic_read(v) ((v).counter)
-// FIXME following needs work
-#define atomic_compareandswap(old, new, v) old
+#define atomic_compareandswap(old, new, v) ((atomic_t){ cmpxchg(v, _atomic_read(old), _atomic_read(new)) })
 
 // see include/asm-ia64/mm.h, handle remaining pfn_info uses until gone
 #define pfn_info page
@@ -227,6 +226,8 @@ struct screen_info { };
 
 #define FORCE_CRASH()  asm("break 0;;");
 
+#define dummy()        dummy_called(__FUNCTION__)
+
 // these declarations got moved at some point, find a better place for them
 extern int ht_per_core;
 
index 0f0e37895b6eefdee9dd8c92da793a5e540dbbf7..83d2542a73a5f402438c09670b8e145fc7b11150 100644 (file)
@@ -11,9 +11,6 @@
 
 extern void arch_do_createdomain(struct vcpu *);
 
-extern int arch_final_setup_guestos(
-    struct vcpu *, struct vcpu_guest_context *);
-
 extern void domain_relinquish_resources(struct domain *);
 
 #ifdef CONFIG_VTI
index ec005549594087edfd1d2c64fbe263f7dd774801..6f0c499531aa50c53831db0ba2e752a582df5970 100644 (file)
@@ -64,18 +64,25 @@ typedef struct {
        unsigned long krs[8];   // kernel registers
        unsigned long pkrs[8];  // protection key registers
        unsigned long tmp[8];   // temp registers (e.g. for hyperprivops)
-//} PACKED arch_shared_info_t;
+//} PACKED arch_vcpu_info_t;
 } arch_vcpu_info_t;            // DON'T PACK 
 
 typedef struct {
+       int evtchn_vector;
+       int domain_controller_evtchn;
+       unsigned int flags;
+//} PACKED arch_shared_info_t;
 } arch_shared_info_t;          // DON'T PACK 
 
 /*
  * The following is all CPU context. Note that the i387_ctxt block is filled 
  * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
  */
+#include <asm/ptrace.h>
 typedef struct vcpu_guest_context {
-    //unsigned long flags;
+       struct pt_regs regs;
+       arch_vcpu_info_t vcpu;
+       arch_shared_info_t shared;
 } PACKED vcpu_guest_context_t;
 
 #endif /* !__ASSEMBLY__ */